import Mock from "mockjs";

const { data } = Mock.mock({
    "data": [{
        // 'img': [
           
        // ],
        // 'name|1':'@cfirst()'+'老师',
        // 'ddtime':'@datetime()',
        // 'str|1':'@ctitle',
        // 'headSculpture|1':'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fblog%2F202101%2F16%2F20210116225104_9d860.jpeg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1681563227&t=a51e7ec40617d5e5bf64fad909d04ad7'
    }
]
})



Mock.mock('/datalist','get',()=>{
    return data
})


//增加一条数据
Mock.mock('/addItem','post',(config)=>{
   
    const req = JSON.parse(config.body) 
    console.log(req);
    data.push(req)
    console.log(data);
    return {
        code:'200',
        masg:'添加成功',
        data
    }
})